# Contributor: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
# Maintainer: Saijin-Naib <Saijin-Naib_package-maintenance@outlook.com>
pkgname=lsd
pkgver=1.1.5
pkgrel=0
pkgdesc="Next-Gen ls command"
url="https://github.com/lsd-rs/lsd"
arch="all"
license="Apache-2.0"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/lsd-rs/lsd/archive/refs/tags/v$pkgver/lsd-$pkgver.tar.gz
	update-libc-crate.patch
	"
# check: tests fail in CI only due to escape code
# net: needed for downloading dependencies
options="!check net"

build() {
	SHELL_COMPLETIONS_DIR=completions cargo auditable build --release --locked
}

check() {
	cargo test --release --locked
}

package() {
	install -Dm755 target/release/lsd -t "$pkgdir"/usr/bin/
	install -D -m644 completions/lsd.bash "$pkgdir"/usr/share/bash-completion/completions/lsd
	install -D -m644 completions/lsd.fish "$pkgdir"/usr/share/fish/vendor_completions.d/lsd.fish
	install -D -m644 completions/_lsd "$pkgdir"/usr/share/zsh/site-functions/_lsd
}

sha512sums="
c35311af977f408170b4c82352d97d05a538816920f9010730a5b3d4cf557817afb0aef14b9f85f91e0d3d7846b8bc6cd841d2421cdb9abd812e36608a848311  lsd-1.1.5.tar.gz
b74fee4c6fe5e141f768cc659cd54997a4cb96ac377403c4185db158f72e467bdc02390aac7bb2ed7ad5a2a75c5f6beec9ddd141ac8d74b5fb99feb553aaafb5  update-libc-crate.patch
"
